package agents;

import jade.core.Agent;
import jade.core.behaviours.*;
import jade.lang.acl.*;


public class Pong extends Agent 
{
	
    protected void setup() 
    {
		addBehaviour(new CyclicBehaviour(this) 
		{
			 public void action() 
			 {
			    ACLMessage msg = receive();
				if (msg!=null) {
					System.out.println( "Recibiendo el email...\n Recibido por Agente: " +
					   myAgent.getLocalName() + ". Lo que se recibio fue: " +
					   msg.getContent() );   
					ACLMessage reply = msg.createReply();
					reply.setPerformative( ACLMessage.INFORM );
					reply.setContent(" Pong" );
					send(reply);
					block();
				 }
				 block();
			 }
		});
	}
}

